home *** CD-ROM | disk | FTP | other *** search
/ Star Festival... a Return to Japan / Star Festival... a Return to Japan.iso / pc / STARFESTIVAL / Shared.Cst / 00027_fScroll.ls < prev    next >
Encoding:
Text File  |  1999-10-10  |  2.0 KB  |  53 lines

  1. on oldfindScroll
  2.   global gSearchTextCast, gFindText
  3.   
  4.   -- is gFindText void
  5.   if not ( voidP(gFindText) ) then
  6.     -- not void, so look in search text for passed string
  7.     if not ( gFindText = "" ) then
  8.       set gSearchText = gSearchTextCast
  9.       --set the scrollTop of member gSearchText = 0
  10.       set thisField = the text of cast gSearchText of castLib "Shared"
  11.       set lineExit = FALSE
  12.       -- count total words in cast member
  13.       set numLines = the number of lines in thisField
  14.       set posnChar = 0
  15.       repeat with i=1 to numLines
  16.         -- count total words in cast member
  17.         set numWords = the number of words in line i of thisField
  18.         -- loop across all words
  19.         repeat with j=1 to numWords
  20.           -- see if this word matches the find word, case-insensitive
  21.           if (word j of line i of thisField = gFindText) then
  22.             -- make sure the second characters are both case-identical
  23.             if (charToNum(char 2 of word j of line i of thisField) = ¬¨
  24.               charToNum(char 2 of gFindText)) then
  25.               --alert "EXACT search hit at" && value(j) && "," && value(i) && ¬¨
  26.               --  word j of line i of thisField
  27.               if (posnChar = 0) then
  28.                 set the scrollTop of member gSearchText = 0
  29.               else if (posnChar > 0) then
  30.                 nothing
  31.                 set the scrollTop of member gSearchText of¬¨
  32.                   castLib "Shared" = value(item 2 of (string( ¬¨
  33.                   charPosToLoc(member gSearchText, posnChar))))
  34.               end if
  35.               -- last word in loop
  36.               set lineExit = TRUE
  37.               exit repeat
  38.             end if
  39.           end if  
  40.         end repeat -- words in line
  41.         if ( lineExit ) then
  42.           -- last line in loop
  43.           exit repeat
  44.         end if
  45.         set posnChar = posnChar + the number of chars in line i of thisField + 1
  46.       end repeat -- lines in text
  47.     end if
  48.   else
  49.     -- void, so do not look
  50.     nothing
  51.   end if
  52. end oldfindScroll
  53.